from selenium import webdriver

#动作库
from selenium.webdriver import ActionChains
import time
class MyText():
    def __init__(self):
        #用谷歌做驱动操作
        self.browser = webdriver.Chrome('C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe')
    #测试注册页面
    def get_url(self,):
        #获取url
        self.browser.get('http://localhost:8080/Reg')
        time.sleep(2)

        #文本框输入
        self.browser.find_elements_by_tag_name('input')[1].send_keys('wangwu2')
        self.browser.find_elements_by_tag_name('input')[2].send_keys('wang123')
        self.browser.find_elements_by_tag_name('input')[3].send_keys('13564879893')
        #滑块
        #第一步 拖拽球体
        time.sleep(1)
        ball = self.browser.find_element_by_class_name('dv_handler')
        #定义动作实例
        actions = ActionChains(self.browser)
        #按住鼠标不台起
        actions.click_and_hold(ball).perform()
        #释放动作
        actions.reset_actions()
        #移动位置
        actions.move_by_offset(270,0).perform()

        time.sleep(1)
        # #注册按钮
        self.browser.find_element_by_class_name('van-button').click()


        time.sleep(2)
        #关闭
        self.browser.close()


mutest = MyText()










